package demo2;

//抽象类
abstract class Shape {
    //抽象方法
    abstract public void draw();
    public int a ;
    public void show() {
        System.out.println("形状");
    }
}

class Circle extends Shape {
    @Override
    public void draw() {
        System.out.println("圆");
    }
}
class Flower extends Shape {
    @Override
    public void draw() {
        System.out.println("❀");
    }
}

public class Test8_3 {
    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        Shape shape = new Circle();//向上转型
        drawMap(shape);
        drawMap(new Flower());
        //new Flower()-->匿名对象 没有名字的对象
        //匿名对象的缺点：不能重复使用
    }
}
